package com.kaifamiao.jdbc.core;

import java.sql.ResultSet;
import java.sql.SQLException;

public class DbHelperTest2 {

    public static void main(String[] args) throws SQLException {
        // 首先获得 DbHelper实例
        DbHelper dh = DbHelper.getInstance();

        // "执行"DQL语句
        ResultSet rs = dh.query( "SELECT empno, ename, job, sal FROM emp WHERE deptno IS NOT NULL" );
        while( rs.next() ){
            int eno = rs.getInt( "empno" );
            String name = rs.getString( "ename" );
            String job = rs.getString( "job" );
            double sal = rs.getDouble( "sal" );
            System.out.printf( "%d , %s, , %s, %f\n" , eno, name, job, sal);
        }

        // 最后释放连接
        dh.release();
    }

}
